<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <link rel="stylesheet" th:href="@{/web/base/css/bootstrap.min.css}"/>
    <link rel="stylesheet" th:href="@{/web/base/css/bootstrap-reset.css}">
    <link rel="stylesheet" th:href="@{/web/base/css/owl.carousel.css}">
    <link rel="stylesheet" th:href="@{/web/base/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{/web/base/css/style.css}">
    <link rel="stylesheet" th:href="@{/web/base/css/style-responsive.css}">
    <link href="/web/base/lib/wangeditor/wangEditor-fullscreen-plugin.css" rel="stylesheet" />
</head>

<body>

<div class="row">
    <div class="col-md-12">
        <section class="panel">
            <div class="panel-body">
                <div class=" form">
                    <form class="cmxform form-horizontal tasi-form" id="commentForm" >
                        <div class="form-group ">
                            <div class="col-md-4">
                                <input type="text" id="title" class="form-control" placeholder="标题">
                            </div>
                        </div>
                        <div class="form-group ">
                            <div class="col-md-4">
                                <input type="text" id="type" class="form-control" placeholder="类别">
                            </div>
                        </div>
                        <div class="form-group ">
                            <div class="col-md-4">
                                <input type="text" id="flag" class="form-control" placeholder="标签">
                            </div>
                        </div>
                        <div class="form-group ">
                            <div class="col-md-4">
                                <select id="status" class="form-control"  >
                                    <option value="1">发布</option>
                                    <option value="0">草稿</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group ">
                            <div class="col-md-6" id="editor">

                            </div>
                            <textarea id="content" hidden="true" ></textarea>
                        </div>

                        <div class="form-group">
                            <div class="col-md-4">
                                <button onclick="add()" class="btn btn-danger"  type="button">提交</button>
                                <a class="btn btn-info" href="/master/article/list">返回</a>
                            </div>
                        </div>
                    </form>
                </div>

            </div>
        </section>
    </div>
</div>

<script th:src="@{/web/base/js/jquery.min.js}"></script>
<script th:src="@{/web/base/js/bootstrap.min.js}"></script>
<script th:src="@{/web/base/js/jquery.dcjqaccordion.2.7.js}"></script>
<script th:src="@{/web/base/js/jquery.scrollTo.min.js}"></script>
<script th:src="@{/web/base/js/jquery.nicescroll.js}"></script>
<script th:src="@{/web/base/js/bootstrap-treeview.min.js}"></script>

<script src="/web/base/lib/wangeditor/wangEditor.min.js"></script>
<script src="/web/base/lib/wangeditor/wangEditor-fullscreen-plugin.js"></script>
<script src="/web/master/js/article-edit.js"></script>
<script>
		var E = window.wangEditor;
    	var editor = new E('#editor');
   	 	var $text1 = $('#content');
   		// 自定义菜单配置
   	    editor.customConfig.menus = [
	   	    'head',  // 标题
	   	     'bold',  // 粗体
	   	     'fontSize',  // 字号
	   	     'fontName',  // 字体
	   	     'italic',  // 斜体
	   	     'underline',  // 下划线
	   	     'strikeThrough',  // 删除线
	   	     'foreColor',  // 文字颜色
	   	     'backColor',  // 背景颜色
	   	     'list',  // 列表
	   	     'justify',  // 对齐方式
	   	     'quote',  // 引用
	   	     'code',  // 插入代码
	   	     'table',  // 表格
	   	     'image',  // 插入图片
	   	     'video',  // 插入视频
	   	     'undo' , // 撤销
	   	     'redo'  // 撤销
   	    ];

   	    editor.customConfig.uploadImgServer = '/master/article/upload';
   	    editor.customConfig.uploadFileName = 'imgFile';
   	 	editor.customConfig.uploadImgMaxLength = 1;           //1张图
   	 	editor.customConfig.uploadImgMaxSize = 1 * 512 * 1024;//512KB

    	editor.customConfig.onchange = function (html) {
        	$text1.val(html);
    	}
    	editor.create();
    	E.fullscreen.init('#editor');

    	// 初始化 textarea 的值
    	editor.txt.html($text1.val())
    	$text1.val(editor.txt.html());
</script>
</body>
</html>
